// 获取当前的环境
import axios from 'axios'
const isdev = process.env.NODE_ENV === 'development'
const request = axios.create({
  baseURL: isdev ? 'http://121.89.205.189:3001/api/' : 'http://121.89.205.189:3001/api/',
  timeout: 6000
})
request.interceptors.request.use((config) => {
  config.headers.token = localStorage.getItem('token')
  return config
}, error => {
  return Promise.reject(error)
})
request.interceptors.response.use((res) => {
  return res.data
}, error => {
  return Promise.reject(error)
})
export default request
